/*
  Copyright 2011 Tobias "Tomoko" Platen

  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef VOICEDEF_MBROLA_H
#define VOICEDEF_MBROLA_H

#include <sekai/VoiceSampler.h>
#include <map>
#include <string>

struct diphone {
  int begin;
  int middle;
  int end;
};

class VoiceDefMBROLA : public VoiceDef {
 public:
  VoiceDefMBROLA(std::string path);
  virtual ~VoiceDefMBROLA();
  void getImpulseResponse(float pos, float* impulseResponse,
                          int* impulseResponseLength,float morph);
  float getLength();

  diphone* getDiphone(std::string index);
  int getSamplerate() { return _samplerate; }
  virtual std::string getPhoLine(int index){return "";}

 private:
  short* _voice_data;
  uint32_t _voice_data_length;
  std::map<std::string, diphone*> _diphone_map;
  int _samplerate;
  int _mbrperiod;
};

// realtime_demo needs upgrade

#endif
